AR	=ar
CC	=gcc
CFLAGS	=-O6

.c.o:
	$(CC) $(CFLAGS) -c -o $*.o $<

all:	libvga.a vgatest dumpreg runx

libvga.a: vga.o
	$(AR) rcs libvga.a vga.o
	cp libvga.a /usr/lib
	cp vga.h /usr/include

vgatest: libvga.a vgatest.o 
	$(CC) $(CFLAGS) -o vgatest vgatest.o -lvga

dumpreg: libvga.a dumpreg.o 
	$(CC) $(CFLAGS) -o dumpreg dumpreg.o -lvga

runx: libvga.a runx.o 
	$(CC) $(CFLAGS) -o runx runx.o -ltermcap -lvga

clean:
	rm -f *.o libvga.a vgatest dumpreg runx

vga.o: vga.c vga.h
vgatest.o: vgatest.c vga.h
dumpreg.o: dumpreg.c vga.h
runx.o: runx.c vga.h

